<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
		<link href="css/table.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="js/table.js"></script>
		<script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
		<script type="text/javascript" src="js/openwindow.js"></script>
		<script type="text/javascript">

function deleteColumn(){
	var arry="";
	var count=0;
	var checks=$("input[name='ids']");
	for(var i=0;i<checks.length;i++){
		if(checks[i].checked){
			if(arry==''){
			arry+="ids="+checks[i].value;
			}else{
			arry+="&ids="+checks[i].value;
			}
			count++;
		}
	}
	if(count==0){
		alert("请选择要删除的数据！");
		return;
	}
	if(confirm("确定要删除？")){
		$.post("columnDelete.action",arry,function(data){
			if(data=="success"){
				alert("删除数据成功！");
				var currentPage=$("#currentPage").val();
				page(currentPage);
			}else{
				alert("删除数据失败！");
			}
		});
	}
}
function clearall(){
	$("#title").val("");
	$("#startTime1").val("");
	$("#startTime2").val("");
	document.searchForm.submit();
}
function page(currentPage){
	$("#page").val(currentPage);
	document.pageForm.submit();
}
function columnUpdate(columnId){
	var url = "columnById.action?columnId="+columnId+"&currentPage=";
		openWindow(url,750,400);
}
function columnAdd(){
	 var url ="columnAdd.action";
	 openWindow(url,500,300);
}
</script>
	</head>
	<body>
		<table border="0" cellpadding="0" cellspacing="0"
			width="100%">
			<tbody>
				<tr>
					<td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
					<td style="background: url('image/wsoa_window_002.gif');">
						<table border="0" cellpadding="0" cellspacing="0">
							<tbody>
								<tr>
									<td align="center"
										style="background: url('image/wsoa_window_002.gif');"
										width="10">
										<img src="image/center_19.gif">
									</td>
									<td align="center"
										style="background: url('image/wsoa_window_002.gif');"></td>
									<td>信息管理 &gt; 栏目管理 &gt; 栏目设置</td>
								</tr>
							</tbody>
						</table>
					</td>
					<td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
				</tr>
				<tr>
					<td style="background: url('image/wsoa_window_010.gif');" width="1">
						&nbsp;
					</td>
					<td>

						<table class="intable">
							<tr>
									<td>
									<input type="button" class="button_02" value="添加"
										onclick="columnAdd()" style="line-height: 20px; float: right" />
								</td>
								<td>
									<input type="button" class="button_02" value="删除"
										onclick="deleteColumn()" style="line-height: 20px; float: right" />
								</td>
							</tr>
						</table>

						<table id="tabllist" class="righ_list" frame="box" cellspacing="1"
							cellpadding="0" width="100%" border="0">
							<tr class="reigh_list2">
								<th width="5%" align="center">
									<input type="checkbox" id="all" onclick="checkAll()" />
								</th>
								<th align="center">
									栏目
								</th>
								<th align="center" width="12%">
									添加人
								</th>
								<th align="center" width="10%">
									添加时间
								</th>
								<th align="center"  width="7%">
								操作
								</th>
							</tr>
							<c:if test="${empty columns}">
								<tr id="row">
									<td colspan="6">
										没有相关的记录！
									</td>
								</tr>
							</c:if>
							<c:forEach items="${columns}" var="column">
								<tr id="row" onmouseover="overStyle(this)"
									onmouseout="outStyle(this)">
									<td width="5%" align="center">
										<input type="checkbox" name="ids" value="${column.id}" />
									</td>
									<td class="td_bg main_ico"  >
											${column.name}
									</td>
									<td width="12%">
										${column.userName }
									</td>
									<td  width="10%">
										<fmt:formatDate value="${column.createTime}" pattern="yyyy-MM-dd" />
									</td>
									<td width="7%" align="center">
										<img alt="修改" onclick="columnUpdate('${column.id}')" src="image/operate_update.gif" style="cursor: pointer">
									</td>
								</tr>
							</c:forEach>
						</table>

					</td>
					<td style="background: url('image/wsoa_window_006.gif');" width="1">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td height="1" width="1">
						<img src="image/wsoa_window_009.gif" height="16" width="14">
					</td>
					<td style="background: url('image/wsoa_window_008.gif');"
						height="1"></td>
					<td height="1" width="1">
						<img src="image/wsoa_window_007.gif" height="16" width="12">
					</td>
				</tr>
			</tbody>
		</table>
		<div class="pageDiv">
			<form action="ColumnManagement.action" name="pageForm" method="post">
				<input type="hidden" id="page" name="currentPage" />
				<%@include file="../page/page.jsp"%>
			</form>
		</div>

	</body>
</html>